import React from 'react';

/** 定义管理页面上下文 */
export interface IManageContext {
  prefixCls: string;
  supplyWay: number;
  applyInfo: Record<string, any>;
  materialList: Record<string, any>[];
  curRes: Record<string, any>;
  dispatch: any;
  ProjectInfo: Record<string, any>;
  locationProps: Record<string, any>;
  successMaterials: Record<string, any>[];
  setSuccessMaterials: any;
  finallyType: string;
  reloadInfoService: () => void;
  // setNewMethod: any;
  // newMethod: any;
  // setOldMethod: any;
  // oldMethod: any;
  page_s: number | null;
  packData: Record<string, any>[];
  setPackData: any;
  type: any;
  dataSource: Record<string, any>[];
  isShowSubmit: boolean;
}

/** 初始化管理页面上下文 */
const init_manage_context: IManageContext = {
  prefixCls: 'apply-update',
  supplyWay: 0,
  applyInfo: {},
  materialList: [],
  curRes: {},
  dispatch: null,
  ProjectInfo: {},
  locationProps: {},
  successMaterials: [],
  setSuccessMaterials: () => {},
  finallyType: '',
  reloadInfoService: () => {},
  // setNewMethod: null,
  // newMethod: null,
  // setOldMethod: null,
  // oldMethod: null,
  page_s: null,
  packData: [],
  setPackData: (res: Record<string, any>[]) => {},
  type: {},
  dataSource: [],
  isShowSubmit: false,
};

/** 创建更新需求管理上下文 */
const ApplyUpdateContext = React.createContext(init_manage_context);

export { ApplyUpdateContext };
